﻿
$(document).ready(function () {
    getWareHourse(); //添加仓库
    getSelectUserGrid("EmployeeName"); //添加用户
    getSelectUserGrid("SenderName");  //添加送货人

});
//添加仓库列表 ---开始
function getWareHourse() {
    $("#StorehouseName").ligerPopupEdit({
        grid: getGridOptions(false),
        valueField: 'Id',
        textField: 'StorehouseName'
    });
}
function getGridOptions(checkbox) {
    var options = {
        columns: [
                        { display: 'Key', name: 'Id', type: 'text', hide: 1 },
                        { display: '仓库名', name: 'StorehouseName', mintWidth: 80, width: 120 },
                        { display: '仓库编码', name: 'StorehouseCode', mintWidth: 80, width: 120 },
                        { display: '状态', name: 'DeletedSate', mintWidth: 60, width: 80 },
                        { display: '仓库类别', name: 'StorehouseTypeName', mintWidth: 80, width: 140 },
                        { display: '组织机构名称', name: 'OrgName', mintWidth: 80, width: 140 },
                         { display: '备注', name: 'Remarks', mintWidth: 140, width: 200 }
                    ], switchPageSizeApplyComboBox: false,
        url: "../WareHose/GetWareHoses?rand=" + Math.random(),
        method: "GET",
        pageSize: 10,
        checkbox: checkbox
    };
    return options;
}

//添加仓库列表 ---结束

//添加用户列表 --开始
function getSelectUserGrid(controllerId) {
  //  $("#EmployeeName").ligerPopupEdit({
    $("#" + controllerId).ligerPopupEdit({
        grid: getUserGridOptions(false),
        valueField: 'Key',
        textField: 'Name'
    });
}
function getUserGridOptions(checkbox) {
    var options = {
        columns: [
                        { display: 'Key', name: 'Key', type: 'text', hide: 1 },
                        { display: '登陆名', name: 'LoginName', mintWidth: 80, width: 120 }, //, type: 'int', mintWidth: 40, width: 100
                        {display: '姓名', name: 'Name', mintWidth: 80, width: 120 },
                        { display: '性别', name: 'Gender', mintWidth: 60, width: 80 },
                        { display: '出生年月', name: 'Birthday', type: 'date', mintWidth: 100, width: 140 },
                        { display: '移动电话', name: 'Mobile', mintWidth: 80, width: 140 },
                        { display: '固定电话', name: 'Tel', mintWidth: 80, width: 140 },
                        { display: 'QQ', name: 'QQ', mintWidth: 80, width: 120 },
                        { display: '组织机构', name: 'OrgName', mintWidth: 80, width: 120 },
                        { display: '部门', name: 'DeptName', mintWidth: 80, width: 120 },
                        { display: '状态', name: 'IsEnable', mintWidth: 80, width: 120 }
                    ], switchPageSizeApplyComboBox: false,
        url: "../User/GetAllUsers?id=" + Math.random(),
        method: "GET",
        pageSize: 10,
        checkbox: checkbox
    };
    return options;
}
//添加用户列表 --结事

//添加送货人 --开始
//function getSelectSenderUserGrid() {
//    $("#SenderName").ligerPopupEdit({
//        grid: getUserGridOptions(false),
//        valueField: 'Key',
//        textField: 'Name'
//    });
//}
//添加送货人 --开始